package karma.main;

import java.util.List;

import net.minecraft.src.*;

public class ItemHellSword extends Item
{
    private int weaponDamage;
    private final EnumToolMaterial toolMaterial;
    
    //public boolean[] runes = new boolean[]{true, false, false, true, false, false};
    //Represents whether or not the runes are:
    //Explosion, Laser, Kill, Vampire, Shadow, Murder
    //In that order

    public ItemHellSword(int i, EnumToolMaterial enumtoolmaterial)
    {
        super(i);
        toolMaterial = enumtoolmaterial;
        maxStackSize = 1;
        setMaxDamage(enumtoolmaterial.getMaxUses());
        weaponDamage = 4 + enumtoolmaterial.getDamageVsEntity();
    }

    /**
     * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
     * sword
     */
    public float getStrVsBlock(ItemStack itemstack, Block block)
    {
        return block.blockID == Block.web.blockID ? 15F : 1.5F;
    }

    /**
     * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
     * the damage on the stack.
     */
    public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
    {
        itemstack.damageItem(1, entityliving1);

        if (!entityliving1.isSneaking())
        {
            entityliving.setFire(3);
        }

        return true;
    }

    public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
    {
        itemstack.damageItem(2, entityliving);
        return true;
    }

    /**
     * Returns the damage against a given entity.
     */
    public int getDamageVsEntity(Entity entity)
    {
        return weaponDamage;
    }

    /**
     * Returns True is the item is renderer in full 3D when hold.
     */
    public boolean isFull3D()
    {
        return true;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack itemstack)
    {
        return EnumAction.block;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack itemstack)
    {
        return 0x11940;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
    {
        entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
        return itemstack;
    }

    /**
     * Returns if the item (tool) can harvest results from the block type.
     */
    public boolean canHarvestBlock(Block block)
    {
        return block.blockID == Block.web.blockID;
    }

    /**
     * Return the enchantability factor of the item, most of the time is based on material.
     */
    public int getItemEnchantability()
    {
        return toolMaterial.getEnchantability();
    }

    /**
     * Return an item rarity from EnumRarity
     */
    public EnumRarity getRarity(ItemStack itemstack)
    {
        return mod_KarmaCraft.ENCHANTED;
    }
    
    public void addInformation(ItemStack itemstack, List list) 
    {
    	/*this.info = list;
    	this.stack = itemstack;
    	
    	if (runes[0])
    	{
    		list.add("Active: Explosion");
    		list.remove("Active: Laser");
    		list.remove("Active: Kill");
    	}
    	
    	if (runes[1])
    	{
    		list.remove("Active: Explosion");
    		list.add("Active: Laser");
    		list.remove("Active: Kill");
    	}
    	
    	if (runes[2])
    	{
    		list.remove("Active: Explosion");
    		list.remove("Active: Laser");
    		list.add("Active: Kill");
    	}
    	
    	if (runes[3])
    	{
    		list.add("Passive: Vampire");
    		list.remove("Passive: Shadow");
    		list.remove("Passive: Murder");
    	}
    	
    	if (runes[4])
    	{
    		list.remove("Passive: Vampire");
    		list.add("Passive: Shadow");
    		list.remove("Passive: Murder");
    	}
    	
    	if (runes[5])
    	{
    		list.remove("Passive: Vampire");
    		list.remove("Passive: Shadow");
    		list.add("Passive: Murder");
    	}*/
    }
}
